pkg_name=mlterm
version=3.4.5
build_dir=$builds_dir_root/$pkg_name-$version
src_dir=$src_dir_root/$pkg_name-$version
url=http://downloads.sourceforge.net/project/mlterm/01release/$pkg_name-$version/$pkg_name-$version.tar.gz

cd "$src_dir_root"
rm -Rf "$pkg_name-$version"
tar zxf "$pkg_name-$version.tar.gz"

rm -Rf "$build_dir"
mkdir -p "$build_dir"
cd "$build_dir"

#there are options in the configure help and others
#in the README file and configure.in
#current libind is obsolete for indic rendering
export CFLAGS=-O0
"$src_dir/configure"					\
	--enable-dl-table=yes				\
	--with-map-table				\
	--with-prop-table				\
	--without-libltdl				\
\
	--prefix=					\
	--disable-static				\
	--disable-debug					\
	--enable-image=yes				\
	--enable-dl-ctl=yes				\
	--enable-fribidi=yes				\
	--enable-dl-type=yes				\
	--disable-ssh2					\
	--disable-utmp					\
	--disable-pty-helper				\
	--enable-use-tools				\
	--disable-dnd					\
	--disable-kbd					\
	--disable-uim					\
	--disable-m17nlib				\
	--disable-ibus					\
	--disable-fcitx					\
	--disable-scim					\
	--disable-vt52					\
	--enable-optimize-redrawing=yes			\
	--enable-nls=yes				\
	--disable-rpath					\
	--disable-ind					\
	--with-x					\
	--with-gui=xlib					\
	--with-gtk=3.0					\
	--with-imagelib=				\
	--with-pthread					\
	--with-type-engines=xft,cairo			\
	--with-tools=mlcc,mlclient,mlimgloader		\
	--without-scrollbars				\
	--with-gnu-ld
unset CFLAGS

make

install_tmp_dir=/tmp/$pkg_name-$version
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir"
make install "DESTDIR=$install_tmp_dir"

#customize the defaults
echo 'DEFAULT=monospace' >>"$install_tmp_dir/etc/mlterm/aafont"
#current mlterm-256color with this ncurses version is buggy use xterm instead
echo 'termtype = xterm-256color' >>"$install_tmp_dir/etc/mlterm/main"
echo 'use_scrollbar = false' >>"$install_tmp_dir/etc/mlterm/main"
echo 'use_xim = true' >>"$install_tmp_dir/etc/mlterm/main"
echo 'input_method = xim' >>"$install_tmp_dir/etc/mlterm/main"

install_dirs "$builders_dir_root/$pkg_name/runtime.dirs"
install_files "$builders_dir_root/$pkg_name/runtime.files" "$install_tmp_dir"
install_links "$builders_dir_root/$pkg_name/runtime.links"
elf_strip "$builders_dir_root/$pkg_name/elf-strip"

rm -Rf "$install_tmp_dir"
rm -Rf "$build_dir"
rm -Rf "$src_dir"
